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

Query time 0.00036