UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SPz6Ub92z/7zUlq34CkJKZn3vmoQMDZxvszefYXOVpk='
WHERE
key_id = '634cdc74d7f5d24c50127d6bd58706fe83c2b463bb281c5e593156cdf7eb8f01'
AND (
token = 'SPz6Ub92z/7zUlq34CkJKZn3vmoQMDZxvszefYXOVpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)