UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oAAvRIAf02Kuml4+YZtyKbgTeQypTS6lKpEKwq+Qixg=' 
WHERE 
  key_id = '3a370b832efc6c467dfd430b130ac2364cae077a0de17039cdc793a638d976ef' 
  AND (
    token = 'oAAvRIAf02Kuml4+YZtyKbgTeQypTS6lKpEKwq+Qixg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035