UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ckw6nFncpmCptKCw5PAw//5U/sgrixxAC97Ro8Pfy9E='
WHERE
key_id = 'a7b6f33994df336125d4257d801eed359d2883fd67c57eba127115a7ea739d0d'
AND (
token = 'ckw6nFncpmCptKCw5PAw//5U/sgrixxAC97Ro8Pfy9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)