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