UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6XS1reL4CWO9z0TG8Foi1UNLVYbHtcPbee2cAhubRwA=' 
WHERE 
  key_id = '144ba41c12e6eacbdac816276970e2df78e3fd6b6c0ce31f011810c574008e94' 
  AND (
    token = '6XS1reL4CWO9z0TG8Foi1UNLVYbHtcPbee2cAhubRwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030