UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7S52g+wi32Df85obUtwNSTbm6DuZRHteBNWSk441OcI='
WHERE
key_id = '1de1ad6a5869767f068bb178cb9494fed2795c48c653a3616887fc375594e4ce'
AND (
token = '7S52g+wi32Df85obUtwNSTbm6DuZRHteBNWSk441OcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)