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

Query time 0.00032