UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EXgWzASFSmvvDx09WiNOqJ7YZ7wnjRgj1pUWB+pHY9k=' 
WHERE 
  key_id = '7e312ee1bb1499242ffe3e2dde6b1371192d0325344052367c6706a3656add40' 
  AND (
    token = 'EXgWzASFSmvvDx09WiNOqJ7YZ7wnjRgj1pUWB+pHY9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016