UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xysj5kJRV1STG+09Qnv3SBUYHVjGm7zYBuxKGf7eWhw='
WHERE
key_id = 'f1ba8b70e46e3385b2d5e7841105e91df97b2d69a531977a20707b3767138b85'
AND (
token = 'Xysj5kJRV1STG+09Qnv3SBUYHVjGm7zYBuxKGf7eWhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)