UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '29vSTV/F4ZesNhRd6+CeeqKfzyVJTeGAlYx/MS5j5io='
WHERE
key_id = '170a689a4fd3da48c96e21e77d38d491f141e273a58a59bd1ac704b1ad77acfe'
AND (
token = '29vSTV/F4ZesNhRd6+CeeqKfzyVJTeGAlYx/MS5j5io='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)