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

Query time 0.00031