UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Eyp+brZ/P8EnrUxCuNpCPDF4VjYgLRsTe2bIq6twG9Y=' 
WHERE 
  key_id = '2a6780cb614d963b8aa5d09aa836af7b80f07d6468529b7e3ab37ecc9222b291' 
  AND (
    token = 'Eyp+brZ/P8EnrUxCuNpCPDF4VjYgLRsTe2bIq6twG9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038