UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0TwTh/GXEa3dCf5yNZ+RGniuCVIb5+CajVBmEcsOnhs='
WHERE
key_id = '52918bd1fefd09301ee626c3b5b7044213025c1c5de5c0e3335c59fa82540e02'
AND (
token = '0TwTh/GXEa3dCf5yNZ+RGniuCVIb5+CajVBmEcsOnhs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)