UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EdHzy5d2y5W4Y5+gVEeRv5twdTzv7TWsLSd9/bjT7fY=' 
WHERE 
  key_id = '4c4abea76368397d2c6779117b3642c01403594d7ebc1f87b6504bc6c27074b7' 
  AND (
    token = 'EdHzy5d2y5W4Y5+gVEeRv5twdTzv7TWsLSd9/bjT7fY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021