UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9IqTbnCbvpd7OGUNzErG3+fofjMolfzee3v358FCmvs='
WHERE
key_id = 'fd6523f8f01d09357b311552d35536d32ca840118f9db90a92c6c14f99bdd265'
AND (
token = '9IqTbnCbvpd7OGUNzErG3+fofjMolfzee3v358FCmvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)