UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '16/j5lcfuAWKHEVeRXJIP2z7AbgltLdr6XtnCq+ZDhA=' 
WHERE 
  key_id = '65f1246a66014bc0419ea8c092456a560402ab3780ac464938d253b7117c86f3' 
  AND (
    token = '16/j5lcfuAWKHEVeRXJIP2z7AbgltLdr6XtnCq+ZDhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029