UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gzX7kn0BdxIgbNk3jZjztVuHt5G14KBo50LhHtsxr6I='
WHERE
key_id = '38537286d69e9a39b27788de07fb45fafefb95fdf31722aa58c0f4fb8c5bd430'
AND (
token = 'gzX7kn0BdxIgbNk3jZjztVuHt5G14KBo50LhHtsxr6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)