UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IRWrtbK51hHw3Lle6pM9B7LlzxTh61yt32qxEJibSEo=' 
WHERE 
  key_id = 'c86a11171fb535a1d770208e1f8b651fe363c1ad4dafa08346e0fef7912baa54' 
  AND (
    token = 'IRWrtbK51hHw3Lle6pM9B7LlzxTh61yt32qxEJibSEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039