UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gPYb2nsz1+sVAMb64Y7GznnvG9M1VsVkIlZZDE1vvCc='
WHERE
key_id = 'b310c376de8ce63372b9d5edc8573c0f9a30a60cbd31b8a8b8499601f9218ae5'
AND (
token = 'gPYb2nsz1+sVAMb64Y7GznnvG9M1VsVkIlZZDE1vvCc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)