UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zordG6hQGz8V5lJG46E1CbSJtX6RrCZpgEVSPEdf5hk='
WHERE
key_id = '96e38b12df41d084256e4dbbf92b6fd63c73a6a96d1f517bf6d4eb589db20123'
AND (
token = 'zordG6hQGz8V5lJG46E1CbSJtX6RrCZpgEVSPEdf5hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)