UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PPfYCQ502fvJL35qZuxO4nQlcl+oeY2NuIKC/WfW+9k='
WHERE
key_id = 'f7248d249b4c6c173dd7c9e5403b12e4e31d8eba2cf23e0284c2d06a65f0971f'
AND (
token = 'PPfYCQ502fvJL35qZuxO4nQlcl+oeY2NuIKC/WfW+9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)