UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8qnrJZwmPYyB7iOEM5VwYyOFScQEUSkD686UxEHqVX8=' 
WHERE 
  key_id = '661482bbda3e227d3a7a6d67f3cb8279b708110b1a5cda7aa72a3d27af32966c' 
  AND (
    token = '8qnrJZwmPYyB7iOEM5VwYyOFScQEUSkD686UxEHqVX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028