UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FA4vu7cqDxeupgB+UC8yPeKsBFZRLRBBQMdt/0Y+3po='
WHERE
key_id = 'd00afe05fa61730458d7c0ae118ab1f5124e34d5aca7db0c0f240319b485a0a1'
AND (
token = 'FA4vu7cqDxeupgB+UC8yPeKsBFZRLRBBQMdt/0Y+3po='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)