UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IxgRf6BdogycTt3FWebCZj2y67NabuWVSM5z26yaloE=' 
WHERE 
  key_id = '0f74d9ca7d4b1ca3653904208f72278c17a46581c02faf33753f2ba5b6e322d4' 
  AND (
    token = 'IxgRf6BdogycTt3FWebCZj2y67NabuWVSM5z26yaloE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042