UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qZcr/IcSBbezwSJV7fupmUEM/+YkWYwvJV23YEt2Us8=' 
WHERE 
  key_id = 'b2aad2963a52cca7ef9f57c8ea1d5b8e9cc667da72742081355fd26d91852ce2' 
  AND (
    token = 'qZcr/IcSBbezwSJV7fupmUEM/+YkWYwvJV23YEt2Us8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022