UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dgszvk2rO8xvc3Qp/vW5FFMbyc3c1/BEa1GVUH+lpFc='
WHERE
key_id = '244e8f5d27ba302d2a10e8235e2210a340ee1102330549548e18fcbd77802adb'
AND (
token = 'dgszvk2rO8xvc3Qp/vW5FFMbyc3c1/BEa1GVUH+lpFc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)