UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W9NqcXrTrSg7AGxihEKS8J4lcoo0TPY8egrHzuFjKq8=' 
WHERE 
  key_id = '907d6a52ce3d71b024f8ed19edd828be4f5961b113699627f265f5d7db28b06c' 
  AND (
    token = 'W9NqcXrTrSg7AGxihEKS8J4lcoo0TPY8egrHzuFjKq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017