UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6T17PXLdfKu5NtxpUUS2ksatIBCzrFU1oqGESipjZDY='
WHERE
key_id = '5c693573b52eb857132d3742e4d3cd7590a5aad9022211da72037dbc3c94b18c'
AND (
token = '6T17PXLdfKu5NtxpUUS2ksatIBCzrFU1oqGESipjZDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)