UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1xtzYbJNRgr+sxdFWfIjgCPg8dGcqGcB1lgVwgkTr8='
WHERE
key_id = 'ffe2c2858887fca24e442a27a27ffe86a067533f712fe61203ff4b4aed77bc80'
AND (
token = 'B1xtzYbJNRgr+sxdFWfIjgCPg8dGcqGcB1lgVwgkTr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)