UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MtaEhtY/ODCGZ0oC7YYWu23E84sQ2sKAQJvPZMn3vHs=' 
WHERE 
  key_id = '183e1622b0bd564e66099af789055a7cef690246d7ea6fc82002f5db298bf232' 
  AND (
    token = 'MtaEhtY/ODCGZ0oC7YYWu23E84sQ2sKAQJvPZMn3vHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050