UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '59QD/Jn6ay5vpa9akOotqIQwblmKzJF+o9WsGVkBs0c='
WHERE
key_id = '587902f8fb4e4473494fe3cf6c23b8148da8be604512da90aa7c1562bcd63c6c'
AND (
token = '59QD/Jn6ay5vpa9akOotqIQwblmKzJF+o9WsGVkBs0c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)