UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qDNiPgebhKYX72DIoVhmfH3MNjbXOxXt8tb3qj2RfQ0='
WHERE
key_id = 'f8adcf851019b7fd2408bc10af4ae9001c9ce235a528d85d841997a12c5973ab'
AND (
token = 'qDNiPgebhKYX72DIoVhmfH3MNjbXOxXt8tb3qj2RfQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)